home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutord.EXE
/
STRTQZ1.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-07-16
|
647b
|
41 lines
/* strtqz1.c */
/*
STRUCTURES QUIZ #2
Draw a memory map and show what would be printed
on the CRT when this program get executed.
*/
struct A1 { char x, y, z; };
struct A2 { int z, y, x; };
struct A3 {
int x, y, z ;
struct A1 a;
struct A2 b;
struct A1 *p;
};
main()
{
static struct A1 a1 = { 'a', 'b', 'c' };
static struct A3 quiz = {
10, 20, 30,
{ 'a', 'b', 0 },
{ 1, 2, 3 },
&a1
};
printf("%d, %c, %d, %d\n", quiz.x, quiz.a.x, quiz.b.z, quiz.z);
pstrc1(&quiz);
}
pstrc1(z)
struct A3 *z;
{
printf("%d, %d, %c\n",z->x, (*z).b.x, z->p->z );
}